\documentclass[10pt]{beamer}
\usetheme{Rochester}

% load syscop style
\usepackage{style/syscop}

%--------------------------------------------------
%  TITLE
%--------------------------------------------------

\title[Contributing]{\huge Contribution guide to \texttt{acados}}
\author[\texttt{acados}]{Robin V, Dimitris K, Andrea Z, Rien Q, and Moritz Diehl}
\institute{Systems Control and Optimization laboratory}
\date[\today]{\today }


%--------------------------------------------------
% Useful packages
%--------------------------------------------------

\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{wasysym}

\begin{document}

\InsertTitle

\begin{frame}{Content}
	\tableofcontents
\end{frame}

\section{Basics}

\begin{frame}{Factsheet}
\begin{description}
	\item[code] \texttt{acados}' core is written in \texttt{C99}
	\item[versioning] \texttt{git}, codebase on \url{www.github.com/acados/acados}
	\item[style] Google's \texttt{C/C++} \hyperlink{http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml}{style guide}
	\item[license] LGPL 3.0
	\item[copyright] ??
	\item[typesetting] \texttt{acados}, no caps.
	\item[build system] CMake
\end{description}
\end{frame}

\begin{frame}{Installation}
	\begin{itemize}
		\item \texttt{git clone git@github.com:acados/acados.git}
		\item \texttt{mkdir build}
		\item \texttt{cd build}
		\item \texttt{cmake -DCMakeBuildType=Release ..}
		\item \texttt{make}
	\end{itemize}
\end{frame}

\begin{frame}{Folder structure}
	\begin{description}
		\item[acados] core of \texttt{acados}
		\item[cmake] \texttt{Cmake} helper functions
		\item[doc] reference, user guide, this presentation \smiley
		\item[examples] collection of runnable code to kickstart users
		\item[experimental] scrap space for crazy ideas
		\item[external] mainly solvers, some developer tools
		\item[test] unit tests
	\end{description}
\end{frame}

\section{Linter}

\begin{frame}{Linter}
	\begin{itemize}
		\item checks for style and potential pitfalls
		\item helps keeping your code clean among developers
		\item we use \texttt{cpplint.py} by Google
		\item \texttt{Cmake} target: run \fbox{\texttt{make lint}} from your build directory
	\end{itemize}
\end{frame}

\section{Unit Testing}

\begin{frame}{Unit Testing}
	\begin{itemize}
		\item proves that your code is not all bad
		\item ideally, you write tests before you write a line of code (TDD)
		\item in \texttt{acados}, enable unit tests with \texttt{cmake -DCMakeBuildType=Test}
	\end{itemize}
	\texttt{catch}
	\begin{itemize}
		\item is what we use as a testing framework for \texttt{C/C++} (on \texttt{github})
		\item tests are written in \texttt{C++}
	\end{itemize}
	\begin{beamerboxesrounded}{Example}
		\texttt{\#define CATCH\_CONFIG\_MAIN} \\
		\texttt{\#include "catch/include/catch.hpp"}\\ 
		\newline
		\texttt{int result = 3 + 5;} \\
		\texttt{REQUIRE(result == 8);}
	\end{beamerboxesrounded}
\end{frame}

\begin{frame}{Unit tests with more files}
	\begin{beamerboxesrounded}{\texttt{test/all\_tests.cpp}:}
		\texttt{\#define CATCH\_CONFIG\_MAIN} \\
		\texttt{\#include "catch/include/catch.hpp"}
	\end{beamerboxesrounded}
	\vspace{0.1cm}
	\begin{beamerboxesrounded}{\texttt{test/foo/test.cpp}:}
		\texttt{\#include catch.hpp} \\
		\texttt{REQUIRE(true);}
	\end{beamerboxesrounded}
	\vspace{0.1cm}
	\begin{beamerboxesrounded}{\texttt{test/bar/test.cpp}:}
		\texttt{\#include catch.hpp} \\
		\texttt{REQUIRE(false);}
	\end{beamerboxesrounded}
	\vspace{0.1cm}
	\centering don't forget to list your source files in \texttt{cmake/test\_sources.cmake}!
\end{frame}

\begin{frame}{Writing Unit Tests}
	\large \underline{Test Driven Development (TDD)}
	\begin{enumerate}
		\item First write a reference implementation (in Octave, MATLAB, Python \ldots) for your algorithm
		\item Then write a unit test testing one aspect
		\item Write a piece of code that passes your test
		\item Repeat 2-3 until full algorithm is correct.
	\end{enumerate}
\end{frame}

\section{Continuous Integration}

\begin{frame}{Travis}
	\begin{beamerboxesrounded}{Continuous Integration}
		CI automates builds, tests, installations on different platforms with different environments. It enables developers to \emph{confidently} make changes in their code.
	\end{beamerboxesrounded}
	\begin{itemize}
		\item we use Travis (free for github projects)
		\item build script is in \texttt{travis.yml} in root folder
		\item if we all push to the same repo, the build will break often. \newline $\rightarrow$ better to each have our own `remote' called \texttt{origin}, the \texttt{acados} remote is e.g. called \texttt{blessed}.
	\end{itemize}
\end{frame}

\section{Miscellaneous}

\begin{frame}{CMake}
	How-to guide: \hyperlink{http://www.slideshare.net/DanielPfeifer1/cmake-48475415}{Introduction and best practices} \\ \vspace{1cm}
	How-\textbf{not}-to guide: \hyperlink{http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/}{CMake anti-patterns}
\end{frame}

\begin{frame}{Interesting literature}
	\begin{itemize}
		\item Kernighan, Ritchie, \emph{The C Programming Language}	(The \texttt{C} bible)	
		\item Robert C. Martin, \emph{Clean Code}
		\item 
		\item \url{http://www.kirp.chtf.stuba.sk/~kvasnica/twsba16/} (slides on software development by Mikhail Kvasnica, STUBA)
		\item \url{joelonsoftware.com} (blog of Stack Overflow CEO)
		\item \ldots
	\end{itemize}
\end{frame}

\bibliographystyle{plain}

\end{document}
